//
// Created by 86186 on 2021/12/8.
//

#ifndef FFMPEG_DECODERESOURCE_H
#define FFMPEG_DECODERESOURCE_H

#include "string"

#include "../config.h"
#include "AVPacketQueue.h"

extern "C" {
#include "../include/libavformat/avformat.h"
#include "../include/libswresample/swresample.h"
#include "../include/libavcodec/avcodec.h"
};

class DecodeResource {
public:
    /**
     * Format I/O context.
     * New fields can be added to the end with minor version bumps.
     * Removal, reordering and changes to existing fields require a major
     * version bump.
     * sizeof(AVFormatContext) must not be used outside libav*, use
     * avformat_alloc_context() to create an AVFormatContext.
     *
     * Fields can be accessed through AVOptions (av_opt*),
     * the name string used matches the associated command line parameter name and
     * can be found in libavformat/options_table.h.
     * The AVOption/command line parameter names differ in some cases from the C
     * structure field names for historic reasons or brevity.
     */
    AVFormatContext *avFormatContext = NULL;
    int streamId = -1;
    AVCodec *avCodec = NULL;
    /**
     * This struct describes the properties of an encoded stream.
     *
     * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
     * be allocated with avcodec_parameters_alloc() and freed with
     * avcodec_parameters_free().
     */
    AVCodecParameters *avCodecParameters = NULL;
    /**
     * main external API structure.
     * New fields can be added to the end with minor version bumps.
     * Removal, reordering and changes to existing fields require a major
     * version bump.
     * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user
     * applications.
     * The name string for AVOptions options matches the associated command line
     * parameter name and can be found in libavcodec/options_table.h
     * The AVOption/command line parameter names differ in some cases from the C
     * structure field names for historic reasons or brevity.
     * sizeof(AVCodecContext) must not be used outside libav*.
     */
    AVCodecContext *avCodecContext = NULL;

    DecodeResource();

    ~DecodeResource();
};


#endif //FFMPEG_DECODERESOURCE_H
